import ajax from './index'

export function agency_list(condition) {
    if(!condition) {
        condition = {
            page: 1,
            num: 100
        }
    }
    return ajax({
        url: "/backend/agency/list",
        method: "get",
        params: condition
    });
}

export function agency_save(param) {
    return ajax({
        url: "/backend/agency/save",
        method: "post",
        data: param
    });
}

export function agency_detail(id) {
    return ajax({
        url: "/backend/agency/detail/" + id,
        method: "get"
    });
}

export function agency_del(id) {
    return ajax({
        url: "/backend/agency/delete?ids=" + id,
        method: "post"
    });
}

export function agency_check(id) {
    return ajax({
        url: "/backend/agency/check?ids=" + id,
        method: "post"
    });
}

export function agency_check2(id) {
    return ajax({
        url: "/backend/agency/check2?ids=" + id,
        method: "post"
    });
}

export function agency_refuse(id) {
    return ajax({
        url: "/backend/agency/refuse?ids=" + id,
        method: "post"
    });
}

export function agency_account_list(gency_id, condition) {
    if(!condition) {
        condition = {
            page: 1,
            num: 100
        }
    }
    return ajax({
        url: "/backend/agency_account/list/" + gency_id,
        method: "get",
        params: condition
    });
}

export function agency_role_list(agency_id) {
    return ajax({
        url: "/backend/agency/role/list/" + agency_id,
        method: "get"
    });
}
export function agency_account_register(agency_id, param) {
    return ajax({
        url: "/backend/agency_account/register/" + agency_id,
        method: "post",
        data: param
    });
}

export function agency_account_detail(agency_id, id) {
    return ajax({
        url: "/backend/agency_account/detail/" + agency_id + "/" + id,
        method: "get"
    });
}
export function agency_account_update(agency_id, id, param) {
    return ajax({
        url: "/backend/agency_account/update/" + agency_id + "/" + id,
        method: "post",
        data: param
    });
}
export function agency_account_delete(agency_id, id) {
    return ajax({
        url: "/backend/agency_account/delete/" + agency_id + "/" + id,
        method: "post"
    });
}
export function agency_account_update_password(agency_id, data) {
    return ajax({
        url: "/backend/agency_account/updatePassword/" + agency_id,
        method: "post",
        data: data
    });
}

export function agency_menus() {
    return ajax({
        url: "/backend/agency/role/menus",
        method: "get"
    });
}
export function agency_role_create(agency_id, param) {
    return ajax({
        url: "/backend/agency/role/create/" + agency_id,
        method: "post",
        data: param
    });
}

export function agency_role_detail(agency_id, id) {
    return ajax({
        url: "/backend/agency/role/detail/" + agency_id + "/" + id,
        method: "get"
    });
}
export function agency_role_edit(agency_id, id, param) {
    return ajax({
        url: "/backend/agency/role/edit/" + agency_id + "/" + id,
        method: "post",
        data: param
    });
}
export function agency_role_delete(agency_id, id) {
    return ajax({
        url: "/backend/agency/role/delete/" + agency_id + "/" + id,
        method: "post"
    });
}
export function agency_categories(parent_id) {
    return ajax({
        url: "/backend/product/categories/" + parent_id,
        method: "get"
    });
}

export function agency_withdraw_list(condition) {
    if(!condition) {
        condition = {
            pageNum: 1,
            pageSize: 20
        }
    }
    return ajax({
        url: "/backend/agency/withdraw_list",
        method: "get",
        params: condition
    });
}
export function agency_withdraw_do(param) {
    return ajax({
        url: "/backend/agency/withdraw_do",
        method: "post",
        data: param
    });
}

export function agency_money_record_list(condition) {
    if(!condition) {
        condition = {
            pageNum: 1,
            pageSize: 100
        }
    }
    return ajax({
        url: "/backend/agency/money_record_list",
        method: "get",
        params: condition
    });
}

export function agency_money_record_list_export(condition) {
    return ajax({
        url: "/backend/agency/money_record_list_export",
        method: "get",
        params: condition
    });
}

export function agency_cat_tree(agency_id) {
    return ajax({
        url: "/backend/agency/cat_tree/" + agency_id,
        method: "get"
    });
}